#pragma once
#ifndef EUCLIENTGUI_EUCLIENTGUI_H
#define EUCLIENTGUI_EUCLIENTGUI_H
#endif
#include <atlstr.h>
#include <tchar.h>
#include <Windows.h>
#include <WindowsX.h>
#include <commctrl.h>
#include "resource.h"
#ifndef EUCLIENTGUI_COMMON_H
#include "common.h"
#endif
#pragma comment(lib, "comctl32.lib")
#pragma comment(linker, "\"/manifestdependency:type='Win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='X86' publicKeyToken='6595b64144ccf1df' language='*'\"")

class CEuSocket;
class CEuClientGUI
{
public:
	static HANDLE m_hMutex;
	static HINSTANCE m_hInstance;
	static HWND m_hWnd;
	static HICON m_hIcon_Aborad;
	static HICON m_hIcon_Country;
	static HICON m_hIcon_Town;
	static HICON m_hIcon_Offline;
	static HMENU m_hMenu;
	static NOTIFYICONDATA m_nd;
	static BOOL m_bOnline;

	static CString m_Server;
	static int m_Port;
	static CString m_UserName;
	static CString m_Password;
	static CString m_Domain;
	static LoginDomain m_LoginMethod;
	
	static DWORD m_Hotkey_Abroad;
	static DWORD m_Hotkey_Town;
	static DWORD m_Hotkey_Country;
	static DWORD m_Hotkey_Offline;
	static DWORD m_Hotkey_Query;
	static DWORD m_CheckInterval;
	static DWORD m_FlowThreshold;

	static CString m_ConfigFilePath;
	static CString m_szNotifyTitle;
	static CString m_szNotifyInfo;
	static CString m_szDownload;
	static CString m_szUpload;
	static CString m_szUsedMoney;
	static CString m_szLeftMoney;
	static CString m_szLastTime;
	static CEuSocket *m_pEuSocket;
public:
	CEuClientGUI(HINSTANCE hinstance);
	~CEuClientGUI(void);
	static int OnInitVal(HINSTANCE hInstance);
	static int OnCreateWnd(HWND hWnd, WPARAM wParam, LPARAM lParam);
	static int PopNotifyIcon(HWND hWnd, TCHAR *pTitle, TCHAR *pInfo, LoginDomain LoginMethod);
	static int OnWndCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
	static int OnNotifyIcon(HWND hWnd, WPARAM wParam, LPARAM lParam);
	static int OnDestroyWnd();
	static int OnInitAcntDlg(HWND hDlg, WPARAM wParam, LPARAM lParam);	
	static int OnSaveAcntInfo(HWND hDlg, WPARAM wParam, LPARAM lParam);
	static int OnInitHotKeyDlg(HWND hDlg, WPARAM wParam, LPARAM lParam);
	static int OnQuery();
	static int OnLogin(LoginDomain LoginMethod);
	static int OnOffline();	
	static int OnSaveHotkey(HWND hDlg, WPARAM wParam, LPARAM lParam);
	static int OnKickOut();
	static BOOL CheckAcntInfo(HWND hDlg);
	static int ShowPropertySheet();
	int CreateWnd();
	int GetIniContent(CString m_IniFile=TEXT("config.ini"));	
	static int RegHotkey(HWND hwnd);
	static int UnregHotKey(HWND hwnd);		
	static int OnAcntNotify(HWND hDlg, WPARAM wParam, LPARAM lParam);
	static int OnHotKeyNotify(HWND hDlg, WPARAM wParam, LPARAM lParam);
	static VOID CenterDialog(HWND hDlg);
	static VOID CALLBACK FlowChkTimer(HWND hWnd, UINT uMsg,
		UINT_PTR idEvent, DWORD dwTime);
	static VOID CALLBACK CheckInTimer(HWND hwnd, UINT uMsg, 
		UINT_PTR idEvent, DWORD dwTime);
	static LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, 
		WPARAM wParam, LPARAM lParam);
	static INT_PTR CALLBACK HotKeyDlgProc(HWND hwndDlg, UINT uMsg,
		WPARAM wParam, LPARAM lParam);	
	static INT_PTR CALLBACK AcountDlgProc(HWND hwndDlg, UINT uMsg,
		WPARAM wParam, LPARAM lParam);	
};